package cn.jeefast.modules.platform.controller;


import cn.jeefast.common.entity.MbResearchStepDataTemplateAnotherIndicators;
import cn.jeefast.common.utils.R;
import cn.jeefast.modules.platform.service.MbResearchStepDataTemplateAnotherIndicators1Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import cn.jeefast.common.base.BaseController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author theodo
 * @since 2020-01-06
 */
@RestController
@RequestMapping("/mbResearchStepDataTemplateAnotherIndicators")
@CrossOrigin
public class MbResearchStepDataTemplateAnotherIndicators1Controller extends BaseController {

    @Autowired
    private MbResearchStepDataTemplateAnotherIndicators1Service researchStepDataTemplateAnotherIndicators1Service;


    @RequestMapping("addOrUpdate")
    public R addOrUpdate(@RequestBody List<MbResearchStepDataTemplateAnotherIndicators> list){
        if (list.size()!=0){
            if(list.get(0).getAiId()!=null){
                //批量更新
                for (MbResearchStepDataTemplateAnotherIndicators mrsdta:list) {
                    researchStepDataTemplateAnotherIndicators1Service.updateById(mrsdta);
                }
            }else{
                //批量插入
                for (MbResearchStepDataTemplateAnotherIndicators mrsdta:list) {
                    researchStepDataTemplateAnotherIndicators1Service.insert(mrsdta);
                }
            }
        }
        return R.ok();
    }
}
